﻿<Window x:Class="RssReader.Wpf.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:nshtml="clr-namespace:RssReader.Common"
        Title="MainWindow" Height="350" Width="525">
    <Grid Margin="2" Background="LightBlue">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <TextBlock Text="{Binding Title}" FontSize="26" Margin="3" Grid.Row="0"/>
        <StackPanel Orientation="Horizontal" Grid.Row="1">
            <ComboBox ItemsSource="{Binding Sources}" SelectedItem="{Binding Selected,Mode=TwoWay}" 
                      DisplayMemberPath="Name" Width="300" Margin="3"/>
            <Button Command="{Binding FetchCommand}" Content=" Read Blog " Margin="3"/>
        </StackPanel>
        <ScrollViewer Grid.Row="2">
        <ItemsControl ItemsSource="{Binding Items}" Background="White">
            <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="LightGray" Margin="5" CornerRadius="4" BorderThickness="2">
                            <StackPanel>
                                <TextBlock TextWrapping="Wrap" FontSize="16" Margin="3" Text="{Binding Header}"/>
                                <StackPanel Orientation="Horizontal" Margin="3">
                                    <TextBlock Text="Published:"/>
                                    <TextBlock Text="{Binding Published}"/>
                                </StackPanel>
                                <Expander Header="Details" Background="LightCyan" >
                                    <WebBrowser HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                                                nshtml:HtmlAttached.Html="{Binding Description}"/>
                                </Expander>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
        </ItemsControl>
        </ScrollViewer>


    </Grid>
</Window>
